package com.unhz.taigu.service.impl;

import com.unhz.generator.dao.ContractMapper;
import com.unhz.generator.pojo.Contract;
import com.unhz.taigu.service.ContractService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author: 王林恩
 * @Description: 订单合同
 * @Date: Created in 上午 8:30 2018/1/30 0030
 * @Modified By:
 */
@Service
public class ContractServiceImpl implements ContractService {
    @Autowired
    private ContractMapper contractMapper;


    @Override
    public Contract findContractById(Integer contractId) {
        Contract contract = contractMapper.selectByPrimaryKey(contractId);
        return contract;
    }

    @Override
    public List<Contract> findContractsByOrderId(Integer orderId) {
        List<Contract> list = contractMapper.selectByOrderId(orderId);
        return list;
    }

    @Override
    public void addContract(Contract contract) {
        contractMapper.insertSelective(contract);
    }

    @Override
    public void deleteContractById(Integer orderId) {
        contractMapper.deleteByPrimaryKey(orderId);
    }

}
